package com.itguigu.Test;

import com.itguigu.dyn.ProxyFactory;
import com.itguigu.proxy.Calculator;
import com.itguigu.proxy.CalculatorPureImpl;
import com.itguigu.statices.CalculatorStaticProxy;

public class test {

    public static void main(String[] args) {
        //创建房东 目标方法
        CalculatorPureImpl calculatorPure = new CalculatorPureImpl();
        //创建中介 代理
        CalculatorStaticProxy calculatorStaticProxy = new CalculatorStaticProxy(calculatorPure);
        calculatorStaticProxy.add(1,2);

        System.out.println("-----------------------------------------------");

        //创建动态代理
        ProxyFactory proxyFactory = new ProxyFactory(calculatorPure);
        Calculator calculator = (Calculator) proxyFactory.getProxy();
        calculator.add(1,2);

    }
}
